/*
    2D FDTD simulator
    Copyright (C) 2019 Emilia Blåsten

    This program is free software: you can redistribute it and/or
    modify it under the terms of the GNU Affero General Public License
    as published by the Free Software Foundation, either version 3 of
    the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public
    License along with this program.  If not, see
    <http://www.gnu.org/licenses/>.
*/
/* gridtmz.h: Contents of the header file that defines the 2D Grid
 * structure and it's function prototypes. This structure now contains
 * pointers for each of the possible field values. However, not all
 * these pointers would be used for any particular grid. The pointers
 * that are meaningful would be determined by the "type" of the grid.
 * The type takes on one of the values of the GRIDTYPE enumeration. */

#ifndef _GRIDTMZ_H
#define _GRIDTMZ_H

enum GRIDTYPE {teZGrid, tmZGrid, threeDGrid};

struct Grid {
  double **hx, **hxUpdateHcoeff, **hxUpdateEcoeff;
  double *hxCols, *hxUpdateHcoeffCols, *hxUpdateEcoeffCols;
  double **hy, **hyUpdateHcoeff, **hyUpdateEcoeff;
  double *hyCols, *hyUpdateHcoeffCols, *hyUpdateEcoeffCols;
  double *hz, *hzUpdateHcoeff, *hzUpdateEcoeff;
  double *ex, *exUpdateHcoeff, *exUpdateEcoeff;
  double *ey, *eyUpdateHcoeff, *eyUpdateEcoeff;
  double **ez, **ezUpdateHcoeff, **ezUpdateEcoeff;
  double *ezCols, *ezUpdateHcoeffCols, *ezUpdateEcoeffCols;
  int sizeX, sizeY, sizeZ;
  int time, maxTime;
  int type;
  double cdtds;
};

typedef struct Grid Grid;

void gridInitUpdateCoeff(Grid *g, int choice);
void gridInit(Grid *g, int choice);
Grid *gridCreate(int sizeX, int sizeY);
void gridDestroy(Grid *g);


#endif

